/* Author: Leverage New Age Media

*/

//*****Replace align attribute with class**************************************************//
function replaceAlign() {
  if (!document.getElementsByTagName('img')) return false;
  $('img[align="left"]').addClass('left').removeAttr('align');
	$('img[align="right"]').addClass('right').removeAttr('align');
	$('img[align="middle"]').addClass('middle').removeAttr('align');
}
//*****Replace target attribute with class**************************************************//
function replaceTarget() {
  if (!document.getElementsByTagName('a')) return false;
  $('a[target]').addClass('newwindow').removeAttr('target');
}
//*****The following function make it possible to have web standard popups**************************************************//
function strictNewWindow() {
  if (!document.getElementsByTagName('a')) return false;
  $('a.newwindow').click(function() {
		window.open($(this).attr('href'));
    return false;
	});
}

//*****Extend the footer to the bottom of the page***************************************//
function extendFooter() {
 $('#Form').removeAttr("style");
 var footerHeight = $('#footerWrap').height();
 var pageHeight = $('#wrap').height();
 var windowHeight = $(window).height();
 var difference = windowHeight - pageHeight;
 if (pageHeight < windowHeight) {
   $('#footerWrap').height(footerHeight + difference);
 } else {
   $('#footerWrap').height('auto');
 }
}

  /***** Add Fade Class to forms *****/
function fadeStuff() {  
  $('.fade').animate({"opacity": .7 });
  $('.fade').hover(function() {
    $(this).stop().animate({ "opacity": 1 });
  }, function() { 
    $(this).stop().animate({ "opacity": .7 });
  });
  
}

function revealBioWrap() {
  $('.toggle').hide();
  $('.bioWrap h5').addClass('inactive');
  $('.bioWrap h5').click(function () {	
	$(this).toggleClass('inactive');
	$(this).toggleClass('active');
  	$(this).parent().find('.toggle').slideToggle();
  });
}

//*****Load all functions**************************************************//
$(document).ready(function(){
  replaceAlign();
  replaceTarget();
  strictNewWindow();
  extendFooter();
  fadeStuff();
  revealBioWrap();
});























